<template>
    <div class="information-increase-v">
        <a-form :form="form" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
            
            <a-form-item >
                <template v-slot:label>
                    <span>
                        受访单位名称
                        <span v-if="isMobile">：</span>
                    </span>
                </template>
                <a-textarea
                    v-model:value="formState.fsfdwmc" 
                    placeholder="请输入受访单位名称"
                    v-decorator="['fsfdwmc', { initialValue:formState.fsfdwmc, rules: rules.fsfdwmc}]"
                    :autosize="{ minRows: 1, maxRows: 100 }" 
                    >
                </a-textarea>
            </a-form-item>
            <a-form-item>
                <template v-slot:label>
                    <span>
                        受访单位地址
                        <span v-if="isMobile">：</span>
                    </span>
                </template>
                <a-textarea
                    v-model:value="formState.fsfdwdz" 
                    placeholder="请输入受访单位地址"
                    v-decorator="['fsfdwdz', { initialValue:formState.fsfdwdz, rules: rules.fsfdwdz}]"
                    :autosize="{ minRows: 2, maxRows: 100 }" 
                    >
                </a-textarea>
            </a-form-item>
            <a-form-item>
                <template v-slot:label>
                    <span>
                        联系人
                        <span v-if="isMobile">：</span>
                    </span>
                </template>
                <a-input
                v-model="formState.flxr" 
                v-decorator="['flxr', { initialValue:formState.flxr, rules: rules.flxr}]"
                placeholder="请输入联系人" />
            </a-form-item>
            <a-form-item label="联系电话">
                <template v-slot:label>
                    <span>
                        联系电话
                        <span v-if="isMobile">：</span>
                    </span>
                </template>
                <a-input
                v-model="formState.flxdh" 
                v-decorator="['flxdh', { initialValue:formState.flxdh, rules: rules.flxdh}]"
                placeholder="请输入联系电话" />
            </a-form-item>
            <a-form-item :wrapper-col="{ span: 14, offset: 8 }">
                <a-button class="blue-btn" type="primary" :loading="confirmLoading" @click="handleSubmit" >开始填写</a-button>
            </a-form-item>
        </a-form>
    </div>
</template>
<script>
import {typeInput, typeNumber, typeSelect, typeCheckbox, typeRadio} from '@/components/compSearchCriteria/ContractType'
import compSelector from '@/components/compSelector/compSelector'
import validator from '@/common/validator'
import {addServe, editServe} from './service/index'
export default {
    components:{
        compSelector
    },
    data(){
        return{
            isMobile:navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i),
            addEditParameter:{},
            confirmLoading:false,
            form: this.$form.createForm(this, { name: 'coordinated' }),
            typeSelect:typeSelect,
            formState:{},
            rules:{
                fsfdwmc: [{
                    required: true,
                    message: '请输入受访单位名称',
                    trigger: 'blur',
                }],
                fsfdwdz: [{
                    required: true,
                    message: '请输入受访单位地址',
                    trigger: 'blur',
                }],
                flxr: [{
                    required: true,
                    message: '请输入联系人',
                    trigger: 'blur',
                }],
                flxdh: [{
                    required: true,
                    message: '请输入联系电话',
                    trigger: 'blur',
                }
                // ,{
                //     pattern: validator.landlineAndPhone.reg,
                //     message: '请输入正确的联系电话',
                //     trigger: 'blur',
                // }
            ],
            },
            formRequer:'',
            optionsArr:[],
            submittedSuccessfully:false,
        }
    },
    mounted(){
        window.localStorage.removeItem('testPaperId')
    },
    updated(){
    },
    methods:{
        handleSubmit(){
            this.form.validateFields((err, values) => {
                if(!err){
                    let data = JSON.stringify(values)
                    this.$router.push('/questionnaireInvestigate?id='+this.$route.query.id+'&valueInfo='+data)
                }
            })
        }
    }

}

</script>
<style lang="less">
.information-increase-v{
    margin: 20px;
}
 
</style>